#!/usr/bin/env node

var fs = require('fs');
var width = 16;
var height = 16;
var ByteSize = width * height * 4;
var totalSize = ByteSize + 54;
var buf = Buffer.alloc(totalSize);

//head信息
buf.write('BM');
buf.writeUInt32LE(totalSize,0x02);
buf.writeUInt32LE(54,0x0a);
buf.writeUInt32LE(40,0x0e);
buf.writeUInt32LE(32,0x1c);
buf.writeUInt16LE(1,0x1a);
buf.writeUInt32LE(ByteSize,0x22);
buf.writeUInt32LE(width,0x12);
buf.writeUInt32LE(height,0x16);

//data部分
for(var i = 54;i < totalSize;i+=4){
    buf.writeUInt32LE(0x00cc0000,i);
}
fs.writeFile('./red.bmp',buf,function(err){
    if(err){
        console.error(err);
        process.exit(1);
    }
});
